Repository navigation
Embed the errcheck analyzer - #35
Merged
Merged
Conversation
constable does not report a diagnostic in a file that carries the generated-code comment, because the next run of the generator overwrites the file. An analyzer that constable embeds from another module knows nothing about that rule. Wrap the analyzer and drop a diagnostic whose position is in a generated file. The wrapper copies the pass so the analyzer keeps the original report function for the files that matter, and the upstream analyzer needs no change. Change-Id: Ice29ad33714bae6921da778bb0c5577d296d5b94
A repository that installs errcheck, sumtype, nilaway, and the rest runs a binary for each, with its own command line, exit code, and rules about which files to report. constable already runs analyzers that another module publishes as a go/analysis analyzer, so these checks can share one command line and one policy. errcheck reports an error that the code discards. The upstream analyzer needs no other analyzer, so the adapter only applies the generated-file rule. The test drives the adapter with analysistest. Its testdata holds an unchecked error in a normal file and one in a generated file, so the test proves both that the analyzer reports and that the wrapper drops the report that constable must not print. Change-Id: I34d6b21c76ae62a5ff346fede72513c5b3744760
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.